package com.example.doctorserver.controller;


import com.example.doctorserver.pojo.Overallresult;
import com.example.doctorserver.response.ApiRestResponse;
import com.example.doctorserver.service.OverallResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/overallResult")
public class OverallresultController {

    @Autowired
    OverallResultService overallResultService;

    //添加总检结论
    @RequestMapping("/saveOverallResult")
    public int saveOverallResult(@RequestBody Overallresult overallresult) {
        return overallResultService.saveOverallResult(overallresult);
    }
    //删除总检结论
    @PostMapping("/removeOverallResult")
    public ApiRestResponse removeOverallResult(@RequestBody  Overallresult overallresult){

        System.out.println("删除总检结论"+overallresult.getOrId());

        overallResultService.removeById(overallresult.getOrId());
        return ApiRestResponse.success("ok");
    }

     // 更新总检结论
    @PostMapping("/updateOverallResult")
    public ApiRestResponse updateOverallResult(@RequestBody Overallresult overallresult){

        int f=overallResultService.updateById(overallresult);

        return ApiRestResponse.success(f);
    }

    //查询总检结论
    @RequestMapping("/listOverallResultByOrderId")
    public List<Overallresult> listOverallResultByOrderId(@RequestBody Overallresult overallResult) {
//        System.out.println("查询总检结论:"+overallResult.getOrderId());
        return overallResultService.listOverallResultByOrderId(overallResult.getOrderId());
    }

}
